package com.clz.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/hi")
public class HelloServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out =response.getWriter();
        out.println("<html>");
        out.println("<head>");
        out.println("<title>标题</title>");
        out.println("</head>");
        out.println("<body>");
        out.println("<h2>servlet输入的内容</h2>");
        out.println("</body>");
        out.println("</html>");
        out.close();
    }
}
